package org.jeecg.modules.third.jg.jss.report.cfcnocarcarrierplatforminfo.service;

import org.jeecg.modules.third.jg.jss.report.cfcnocarcarrierplatforminfo.entity.CfcNocarcarrierplatforminfo;
import org.jeecg.modules.third.jg.jss.report.cfcnocarcarrierplatforminfo.mapper.CfcNocarcarrierplatforminfoMapper;
import org.jeecg.modules.wlhy.company.entity.HyCompany;
import org.jeecg.modules.wlhy.hyconfig.entity.HyConfig;
import org.jeecg.modules.wlhy.utils.HyConfigUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * 网络货运平台信息
 * @Description: CFC_NOCARCARRIERPLATFORMINFO
 * @Author: jeecg-boot
 * @Date:   2021-11-25
 * @Version: V1.0
 */
@Service
public class CfcNocarcarrierplatforminfoService {


    @Resource
    private CfcNocarcarrierplatforminfoMapper nocarcarrierplatforminfoMapper;

    public String getEnterpriseCode() {
        return enterpriseCode;
    }

    public void setEnterpriseCode(String enterpriseCode) {
        this.enterpriseCode = enterpriseCode;
    }

    private String enterpriseCode;

//    public int addCompany(HyCompany company) {
//
//        CfcNocarcarrierplatforminfo nocarcarrierplatforminfo =  nocarcarrierplatforminfoMapper.getInfoByName(company.getCompanyName());
//        if(nocarcarrierplatforminfo != null){
//            return 0;
//        }
//
//        nocarcarrierplatforminfo =  companyTONocarcarrierplatforminfo(company);
//        return  nocarcarrierplatforminfoMapper.insertCompanyInfo( nocarcarrierplatforminfo);
//
//    }


    public CfcNocarcarrierplatforminfo companyTONocarcarrierplatforminfo(HyCompany company) {
        if (company == null) {
            return null;
        }
        CfcNocarcarrierplatforminfo cfcNocarcarrierplatforminfo = new CfcNocarcarrierplatforminfo();

        //HyConfig systemConfig = HyConfigUtils.getConfig();
        cfcNocarcarrierplatforminfo.setPlatformcode(this.getEnterpriseCode());

        cfcNocarcarrierplatforminfo.setEnterprisename(company.getCompanyName());
        cfcNocarcarrierplatforminfo.setEnterpriseregistrationaddress(company.getDetailAddress());

        String registerMoney = company.getRegisterMoney().replace("万","");
         registerMoney = registerMoney.replace("万元","");
         registerMoney = registerMoney.replace("w","");

        cfcNocarcarrierplatforminfo.setRegisteredcapital(new BigDecimal(registerMoney));
        cfcNocarcarrierplatforminfo.setUnifiedsocialcreditldentifier(company.getCreditCode());
        cfcNocarcarrierplatforminfo.setUnifiedsocialdatetime(company.getRegisterDate());

        cfcNocarcarrierplatforminfo.setBusinessscope(company.getRunScope());
        cfcNocarcarrierplatforminfo.setBusinesslicensestartdatetime(company.getRegisterDate());
        cfcNocarcarrierplatforminfo.setBusinesslicenseenddatetime(company.getBusinessLicenseExpiredDate());
        cfcNocarcarrierplatforminfo.setCountrysubdivisioncode(company.getAreaCode());
        cfcNocarcarrierplatforminfo.setPermitnumber(company.getPermitNumber());

        cfcNocarcarrierplatforminfo.setLegalpersonname(company.getLegalName());
        cfcNocarcarrierplatforminfo.setLegalpersontelephonenumber(company.getLegalerTel());
        cfcNocarcarrierplatforminfo.setContactname(company.getLegalName());
        cfcNocarcarrierplatforminfo.setContactmobiletelephonenumber(company.getLegalerTel());

        cfcNocarcarrierplatforminfo.setEnterprisecreatetime(company.getEnterpriseCreateTime());

        cfcNocarcarrierplatforminfo.setRegisterdate(company.getRegisterDate());
        cfcNocarcarrierplatforminfo.setIsbranch("0");
        cfcNocarcarrierplatforminfo.setIpcnum("赣B2-20200172");
        cfcNocarcarrierplatforminfo.setPsnrnum("13050013002-20001");



        return cfcNocarcarrierplatforminfo;
    }


}
